﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using BLL;
using Entity;
namespace BookStore.Controllers
{
    public class CommentController : Controller
    {
        //
        // GET: /Comment/                   
        //评论信息管理
        public ActionResult CommentMessage()
        {
            ViewBag.tt = L_CommentBLL.SelectComment();
            return View();
        }
        //处理评论信息
        public ActionResult UpdateComment()
        {
            string CommentId = Request["CommentId"];
            Comment c = new Comment();
            c.CommentId = Convert.ToInt32(CommentId);
            L_CommentBLL.UpdateComment(c);
            return RedirectToAction("CommentMessage");
        }
        //订单信息管理
        public ActionResult OrderMessage()
        {
            ViewBag.tt = L_CommentBLL.SelectOrder();
            return View();
        }
        //处理订单信息
        public ActionResult UpdateOreder()
        {
            string OrderId = Request["OrderId"];
            OrderInformatica o = new OrderInformatica();
            o.OrderId = (OrderId);
            L_CommentBLL.UpdateOreder(o);
            return RedirectToAction("OrderMessage");
        }
        public ActionResult UpdateOrderMessage()
        {
            string AddressId = Request["AddressId"];
            OrdersandAddress s = new OrdersandAddress();
            s.AddressId = Convert.ToInt32(AddressId);
            ViewBag.tt = L_CommentBLL.UpdateOrederMessage(s);
            return View();
        }
        [HttpPost]
        public ActionResult UpdateOrderMessage(ShoppingAddress s)
        {
            ShoppingAddress sp = new ShoppingAddress();
            sp.Name = s.Name;
            sp.AddressValue = s.AddressValue;
            sp.phone = s.phone;
            L_CommentBLL.UpdateShop(s);
            return RedirectToAction("OrderMessage");
        }
    }
}
